package com.example.starter.work3

import io.vertx.core.AbstractVerticle
import io.vertx.core.Promise
import io.vertx.core.Vertx
import io.vertx.core.eventbus.Message
import io.vertx.ext.web.client.WebClient
import org.jsoup.Jsoup

/**
@author whd
@date 2023/10/10 15:20:24
 */
class ServerVerticle: AbstractVerticle() {
  override fun start() {
    vertx.eventBus().consumer<String>("url") { message ->
      val url = message.body()
      val client = WebClient.create(vertx)
      client.getAbs(url).send().onSuccess { res ->
         message.reply(res.bodyAsString()) }
     // content = Jsoup.connect(url).get().body().toString()
    }
  }


  override fun stop() {
    super.stop()
  }
}
